package com.leo.springbootmultithreadbasic.volatilekey;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Leo
 * @version V1.0
 */
public class MyThread extends Thread{

    private static final Logger logger = LoggerFactory.getLogger(MyThread.class);

    volatile private boolean isRunning = true;

    public void setRunning(boolean isRunning) {
        this.isRunning = isRunning;
    }


    @Override
    public void run() {
        logger.info("进入 run 了");

        while (isRunning) {

        }

        logger.info("线程停止了");

    }
}
